Redis Protocol
Structs and functions for implementing the Redis protocol.
Install
With cargo edit.
cargo add redis-protocol
Features
- Supports RESP2 and RESP3, including streaming frames.
- Parse publish-subscribe messages.
- Support cluster redirection errors.
- Implements cluster key hashing.
- Utility functions for converting from RESP2 to RESP3.
This library relies heavily on the Bytes
interface to implement parsing logic such that buffer contents never need to move or be copied.
Examples
use *;
use ;
Decode Logs
Use the decode-logs
feature to enable special TRACE logs during the Frame decoding process.
Decoding BytesMut
Using the default decoder interface with BytesMut
can be challenging if the goal is to avoid copying or moving the buffer contents.
To better support this use case (such as the codec interface) this library supports a decode-mut
feature flag that can parse BytesMut
without copying or moving the buffer contents.
IndexMap
Enable the index-map
feature to use IndexMap instead of HashMap
and HashSet
. This is useful for testing and may also be useful to callers.